#ifndef Sprite_h
#define Sprite_h

struct Module
{
	int x, y, w, h;
	Module () : x(0), y(0), w(0), h(0){};
};

struct FModule
{
	int FM_ID, x, y, flag;
};


struct AFrame
{
	int AF_ID, time, x, y, flag;
};

struct Frame
{
	FModule* fmodule;
	Module* rect;
};


struct Anim
{
	AFrame* aframe;
};

class Sprite
{
private:
	//draw a char
	void DrawChar ( char ch, int _x, int _y );


public:	
	
	int imageID;
	int width;
	int height;
	Module* modules;
	Frame* frames;
	Anim* anims;

	int fontMapping[256]; //for font


	Sprite ();
	~Sprite();
	//Paint module
	void PaintModule ( int moduleID, int _x, int _y, int flag );

	//paint module with scale 0-100
	void PaintModule ( int moduleID, int _x, int _y, int flag, int scale );

	//Paint each module's a frame
	void PaintFModule (int frameID, int moduleID, int _x, int _y );

	//Paint each module's a frame with scale 0 - 100
	void PaintFModule (int frameID, int moduleID, int _x, int _y, int scale );

	//Paint frame
	void PaintFrame ( int frameID, int _x, int _y);

	//Paint frame with scale 0 - 100
	void PaintFrame ( int frameID, int _x, int _y, int scale);

	//Paint each frame's a anim
	void PaintAFrame ( int animID, int frameID, int _x, int _y );

	//Paint each frame's a anim with scale
	void PaintAFrame ( int animID, int frameID, int _x, int _y, int scale );

	//get num of module of a frame
	int GetFModules ( int frameID );

	//get num of frame of a anim
	int GetAFrames ( int animID );

	//get a frame rect
	Module GetFrameRect ( int frameID );
	//get list frame rect
	Module* GetFrameRects ( int frameID );

	//set font mapping
	void SetFontMapping ( int mapping[] );

	//draw string
	void DrawString (char* str, int _x, int _y, int anchor );
	void DrawString (char* str, int _x, int _y );

};
#endif